
package com.uchedao.seller.widget.loadstate;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.RelativeLayout;

import com.google.gson.Gson;
import com.uchedao.seller.inf.ISave;
import com.uchedao.seller.widget.loadstate.base.IView;


/**
  * @ClassName: UCheDaoRelativeLayout
  * @Description: 规定写法
  * @author wushan
  * @date 2014-11-6 上午9:59:22
  *
  */
public abstract class UCheDaoRelativeLayout extends RelativeLayout implements IView,ISave {

    protected Context mContext;
    private Gson gson = new Gson();
    public UCheDaoRelativeLayout(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        init(context);
    }

    public UCheDaoRelativeLayout(Context context) {
        super(context);
        init(context);
    }

    public UCheDaoRelativeLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context);
    }

    private void init(Context context) {
        mContext = context;
        initDataBeforView();
        initView();
        initDataAfterView();
        initListener();

    }

    @Override
    public void initDataBeforView() {
    }

    /**
     * 不导出无Expose注解的字段
     *
     * @param src
     * @return
     */
    public String toJson(Object src) {
        return gson.toJson(src);
    }

}
